package it.niedermann.android.markdown.markwon.plugins

import android.content.Context
import android.widget.TextView
import io.noties.markwon.base.AbstractMarkwonPlugin
import io.noties.markwon.base.MarkwonPlugin

//import static it.niedermann.android.markdown.MentionUtil.setupMentions;
class NextcloudMentionsPlugin private constructor(context: Context, mentions: Map<String, String>) :
    AbstractMarkwonPlugin() {
    private val context: Context
    private val mentions: Map<String, String>

    init {
        this.context = context.applicationContext
        this.mentions = mentions
    }

    override fun afterSetText(textView: TextView) {
        super.afterSetText(textView)
        /*try {
            setupMentions(SingleAccountHelper.getCurrentSingleSignOnAccount(context), mentions, textView);
        } catch (NextcloudFilesAppAccountNotFoundException | NoCurrentAccountSelectedException e) {
            e.printStackTrace();
        }*/
    }

    companion object {
        fun create(context: Context, mentions: Map<String, String>): MarkwonPlugin {
            return NextcloudMentionsPlugin(context, mentions)
        }
    }
}